package cn.shujuhai.common.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;

/**
 * @Author: NiuYaHu
 * @Date: 2025/2/18 16:54
 * @Description: messages 配置类
 **/
@Configuration
public class MessageConfig {

    @Bean
    public ReloadableResourceBundleMessageSource messageSource() {
        ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
        messageSource.setBasename("classpath:messages");  // 设置资源文件的基础路径
        messageSource.setDefaultEncoding("UTF-8");  // 设置资源文件的编码为UTF-8
        return messageSource;
    }
}